$("#form-dispatchSalesmanDetails-add").validate({
	rules:{
		userId:{
			required:true,
		},
	},
	submitHandler:function(form){
		add();
	}
});

function add() {
	var salesUserId = $("select[name='userId']").val();
	var orderId = $("input[name='orderId']").val();
	$.ajax({
		cache : true,
		type : "POST",
		url : ctx + "/module/order/salesmanDetailsSave",
		data : {
			"salesUserId": salesUserId,
			"orderId": orderId,
		},
		async : false,
		error : function(request) {
			$.modalAlert("系统错误", "error");
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg("新增成功,正在刷新数据请稍后……",{icon:1,time: 500,shade: [0.1,'#fff']},function(){
					$.parentReload();
				});
			} else {
				$.modalAlert(data.msg, "error");
			}
		}
	});
}